# from sqlalchemy import create_engine
# from sqlalchemy.orm import sessionmaker
# from mooc.core.config import settings
# from typing import Generator
# from mooc.db.base import Base

# # 创建数据库引擎
# engine = create_engine(
#     settings.SQLALCHEMY_DATABASE_URI,
#     pool_pre_ping=True,
#     echo=settings.SQLALCHEMY_ECHO
# )

# # 创建表
# def init_db():
#     Base.metadata.create_all(bind=engine)

# # 创建会话工厂
# SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# def get_db() -> Generator:
#     """
#     获取数据库会话的依赖项
#     """
#     try:
#         db = SessionLocal()
#         yield db
#     finally:
#         db.close()